using System;
using System.Collections.Generic;
using System.Text;

using PickGold;
using PickGold.Database;
using DataCommon = PickGold.Database.Common;

namespace PickGold.Entities.Table
{
    public class CBaseSettingInfo : CBaseTable
    {
        //
        public const string ENTITY_NAME = "tb_sys_setting_info";
        public const string ENTITY_ALIAS = "settings";
		public const string ENTITY_KEY = DataCommon.SYS_ID;
		public const string ENTITY_SYMBOL = DataCommon.SYS_NAME;
        //
		public const string ITEM_VALUE = DataCommon.ITEM_VALUE;
		public const string ITEM_TYPE = DataCommon.ITEM_TYPE;
		public const string USER_ID = DataCommon.USER_ID;
        //
        private SBaseSettingInfo _ = null;
        //
        public CBaseSettingInfo() : base(ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseSettingInfo(CDatabase db) : base(db, ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseSettingInfo(string alias) : base(ENTITY_NAME, alias) { }
        public CBaseSettingInfo(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseSettingInfo());
        }
        protected void SetSchema(SBaseSettingInfo s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(ITEM_VALUE, typeof(string)).MaxLength = 2048;
            this._DataTable.Columns.Add(ITEM_TYPE, typeof(string)).MaxLength = 10;
            this._DataTable.Columns.Add(USER_ID, typeof(long)).DefaultValue = this._.UserID;
        }
        //
        #region Property
        //
        public string ItemValue
        {
            set
            {
                this._.ItemValue = value;
                this.SetValue(ITEM_VALUE, value);
            }
            get
            {
                return this._.ItemValue;
            }
        }
        //
        public string ItemType
        {
            set
            {
                this._.ItemType = value;
                this.SetValue(ITEM_TYPE, value);
            }
            get
            {
                return this._.ItemType;
            }
        }
        //
        public long UserID
        {
            set
            {
                this._.UserID = value;
                this.SetValue(USER_ID, value);
            }
            get
            {
                return this._.UserID;
            }
        }
        //
        #endregion
        //
        public override bool MoveTo(int position)
        {
            if (!base.MoveTo(position))
                return false;
            this._.ItemValue = this.GetValue<string>(ITEM_VALUE);
            this._.ItemType = this.GetValue<string>(ITEM_TYPE);
            this._.UserID = this.GetValue<long>(USER_ID);
            return true;
        }
        //
    }
    //
    public class SBaseSettingInfo : SBaseTable
    {
        //
        public string ItemValue = null;
        public string ItemType = null;
        public long UserID = -1;
        //
    }
    //
}
//
